<?php if(!defined('BASEPATH'))exit('No direct script access allowed');if(!function_exists('set_realpath')){function set_realpath($path,$check_existance=FALSE){if(preg_match("#^(http:\/\/|https:\/\/|www\.|ftp|[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#i",$path)){show_error('The path you submitted must be a local server path, not a URL');}if(function_exists('realpath')AND@realpath($path)!==FALSE){$path=realpath($path).'/';}$path=preg_replace("#([^/])/*$#","\\1/",$path);if($check_existance==TRUE){if(!is_dir($path)){show_error('Not a valid path: '.$path);}}return $path;}}